<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
        <style>
            .skus-warp span {
                text-align: center;
                display: flex;
                flex-direction: column;
                margin: 0 15px;
                border: 1px solid #f8f8f8;
                border-radius: 5px;
            }
        </style>
        <div class="layui-form-item">
            <label class="layui-form-label">机器编号</label>
            <div class="layui-input-block">
                <input type="text" name="machine_id" class="layui-input" lay-verify="required" placeholder="请输入机器编号"
                       value="{$row.machine_id|default=''}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">机器名称</label>
            <div class="layui-input-block">
                <input type="text" name="machine_name" class="layui-input" lay-verify="required" placeholder="请输入机器名称"
                       value="{$row.machine_name|default=''}" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">规格：</label>
            <div class="layui-input-block">
                <a class="layui-btn layui-btn-primary" data-open="machine.machine/dialog" data-title="添加规格"
                   data-full="false">添加规格</a>

                <table class="layui-table" id="spec-table">
                    <thead>
                    <tr>
                        <th>规格名</th>
                        <th>规格值</th>
                    </tr>
                    </thead>
                    <tbody class="skus-warp">
                        {volist name="list" id="v"}
                            <tr>
                                <td data-id="{$v.id}">{$v.title}</td>
                                <td>
                                    {volist name="v.list" id="vo"}
                                    {$vo.title}
                                    {if condition="$vo.title neq '自选'"}
                                    <div style="display: flex;flex-direction: row;align-items: center;">
                                        <span>金额:<input type="text" name="items[{$vo.id}][money]" class="layui-input" lay-verify="required" value="{$vo.money}" placeholder="请输入金额" style="width: 100px;margin-left: 10px;"></span>
                                        <span>参数:<input type="text" name="items[{$vo.id}][value]" class="layui-input" lay-verify="required" value="{$vo.value}" placeholder="请输入参数" style="width: 100px;margin-left: 10px;"></span>
                                        <span>库存：<input type="text" name="items[{$vo.id}][stock]" class="layui-input" lay-verify="required" value="{$vo.stock}" placeholder="请输入库存" style="width: 100px;margin-left: 10px;"></span>
                                        <span>是否推荐: <input type="checkbox" name="items[{$vo.id}][hot]" class="layui-input" lay-verify="required" value="1" placeholder="请输入参数" style="width: 100px;margin-left: 10px;" lay-skin="switch" lay-text="推荐|不推荐" {if condition="$vo.type eq 1"}checked{/if}></span>
                                        <span>状态：<input type="checkbox" name="items[{$vo.id}][status]" lay-skin="switch" lay-text="正常|关闭" {if condition="$vo.status eq 1"}checked{/if}></span>
                                        <span>判断库存：<input type="checkbox" name="items[{$vo.id}][is_stock]" lay-skin="switch" lay-text="是|否" {if condition="$vo.is_stock eq 1"}checked{/if}></span>
                                    </div>
                                    {else /}
                                    <div style="display: flex;flex-direction: row;align-items: center;">
<!--                                        金额:-->
<!--                                        <input type="text" name="items[{$vo.id}][money]" class="layui-input" lay-verify="required" value="{$vo.money}" placeholder="请输入金额" style="width: 100px;margin-left: 10px;">-->
                                        <span>参数:<input type="text" name="items[{$vo.id}][value]" class="layui-input" lay-verify="required" value="{$vo.value}" placeholder="请输入参数" style="width: 100px;margin-left: 10px;"></span>
                                        <span>库存：<input type="text" name="items[{$vo.id}][stock]" class="layui-input" lay-verify="required" value="{$vo.stock}" placeholder="请输入库存" style="width: 100px;margin-left: 10px;"></span>
<!--                                        是否推荐: <input type="checkbox" name="items[{$vo.id}][hot]" class="layui-input" lay-verify="required" value="1" placeholder="请输入参数" style="width: 100px;margin-left: 10px;" lay-skin="switch" lay-text="推荐|不推荐">-->
                                        <span>状态：<input type="checkbox" name="items[{$vo.id}][status]" lay-skin="switch" lay-text="正常|关闭" {if condition="$vo.status eq 1"}checked{/if}></span>
                                        <span>判断库存：<input type="checkbox" name="items[{$vo.id}][is_stock]" lay-skin="switch" lay-text="是|否" {if condition="$vo.is_stock eq 1"}checked{/if}></span>
                                    </div>

                                    {/if}
                                    <hr>
                                    {/volist}
                                </td>
                            </tr>

                        {/volist}
                    </tbody>
                </table>
            </div>
        </div>

        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<script type="text/javascript">
    let machine_cate_row = "{$row.machine_cate}";
</script>